import { Route } from "react-router-dom";
import routesMap from "./routesMap";
export function createRoutes(routesArr) {
  return routesArr.map((item) => {
    console.log(item.path, item.component);
    if (item.children && item.children.length) {
      return (
        <Route
          path={item.path}
          Component={routesMap[item.component]}
          key={item.path}
        >
          {createRoutes(item.children)}
        </Route>
      );
    } else {
      return (
        <Route
          path={item.path}
          Component={routesMap[item.component]}
          key={item.path}
        />
      );
    }
  });
}
